#include "my_header.h"
typedef enum{
    CD = 0,
    LS,
    LL,
    PWD,
    PUTS,
    GETS,
    REMOVE,
    MKDIR,
    RMDIR,
    QUIT
}commandType;

typedef struct TLVtrain_s{
    commandType type;
    int length;
    char data[4096];
}TLVtrain_t;

typedef struct train_s{
    int length;
    char data[4096];
}train_t;

typedef struct client_s{
    int fd;
    char userName[1024];
    char pwd[1024];
    char *pwdStack[64];
    int stackTop;
}client_t;

int workCmd(int netFd);
void initPwdStack(client_t *client, const char *base);
void getPwdFromStack(client_t *client, char *outPath, size_t len);
void destroyPwdStack(client_t *client);
int sendFile(int netFd,char *file);
int recvFile(int netFd);
int recvn(int sockfd, void *buf, int length);
int doCd(client_t *pclient,const char *targetName);
int doLs(client_t *pclient);
int doLl(client_t *pclient);
/* int doPwd(client_t *pclient); */
int doPuts(client_t *pclient);
int doGets(client_t *pclient,const char *targetName);
int doRemove(client_t *pclient,const char *targetName);
int doMkdir(client_t *pclient,const char *targetName);
int doRmdir(client_t *pclient,const char *targetName);
